![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
deep-equal
Advanced tools
Package description
The deep-equal npm package is a library for performing deep equality checks between two values. It is useful for comparing objects, arrays, and other nested structures to determine if they are equivalent in structure and content, regardless of whether they are the same reference in memory.
Deep comparison of objects and arrays
This feature allows you to compare objects and arrays to see if they are structurally identical, even if they are different instances.
const deepEqual = require('deep-equal');
const obj1 = { a: 1, b: { c: 1 } };
const obj2 = { a: 1, b: { c: 1 } };
console.log(deepEqual(obj1, obj2)); // true
Comparison with custom options
This feature allows you to specify options for the comparison, such as strict mode, which requires the values to be of the same type as well.
const deepEqual = require('deep-equal');
const obj1 = { a: 1 };
const obj2 = { a: '1' };
const options = { strict: true };
console.log(deepEqual(obj1, obj2, options)); // false
Lodash provides a method called isEqual which can perform deep comparisons between two values. It is part of the larger Lodash utility library, which offers a wide range of functions for manipulating and comparing data.
This package offers a fast deep equality comparison algorithm. It is known for its performance and is a good choice when speed is a critical factor.
Underscore.js provides an isEqual function that is similar to Lodash's isEqual. It is part of the Underscore utility library, which is a smaller and more focused alternative to Lodash.
Changelog
Readme
Node's assert.deepEqual() algorithm
as a standalone module.
This module is around 5 times faster
than wrapping assert.deepEqual()
in a try/catch
.
var equal = require('deep-equal');
console.dir([
equal(
{ a : [ 2, 3 ], b : [ 4 ] },
{ a : [ 2, 3 ], b : [ 4 ] }
),
equal(
{ x : 5, y : [6] },
{ x : 5, y : 6 }
)
]);
var deepEqual = require('deep-equal')
Compare objects a
and b
, returning whether they are equal according to a
recursive equality algorithm.
If opts.strict
is true
, use strict equality (===
) to compare leaf nodes.
The default is to use coercive equality (==
) because that's how
assert.deepEqual()
works by default.
With npm do:
npm install deep-equal
With npm do:
npm test
MIT. Derived largely from node's assert module.
FAQs
node's assert.deepEqual algorithm
The npm package deep-equal receives a total of 19,607,042 weekly downloads. As such, deep-equal popularity was classified as popular.
We found that deep-equal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.